package com.agritech.chain;

public class FaultDetectionHandler extends AbstractSafetyHandler {
    public FaultDetectionHandler() {
        super("设备故障预警处理器");
    }

    @Override
    protected boolean canHandle(String requestType) {
        return "DEVICE_FAULT_DETECTED".equalsIgnoreCase(requestType);
    }

    @Override
    protected void processRequest(String details) {
        System.out.println("处理设备故障预警: " + details);
        if (details.contains("轻微")) {
            System.out.println("记录轻微故障，建议维护。");
        } else if (details.contains("严重")) {
            System.out.println("检测到严重故障! 立即停止设备，并发送警报给管理员!");
            // 模拟停止设备和发送警报
        } else {
            System.out.println("未知等级故障: " + details + ", 进行标准检查程序。");
        }
    }
}